<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>重新声明JavaScript变量</title>
</head>

<body>
    <script>
        //如果重新声明 JavaScript 变量，该变量的值不会丢失：
        //在以下两条语句执行后，变量 carname 的值依然是 "Volvo"：
        var carname = "Volvo";
        var carname;
        console.log(carname);   //Volvo
    </script>
</body>

</html>